home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / phantz.arc / PHANT5.Z / PHANT5
Text File  |  1991-06-06  |  60KB  |  2,459 lines

  1.  
  2. : ---------CUT HERE---------
  3. : This is a shar archive.  Extract with sh, not csh.
  4. : The rest of this file will extract:
  5. :  phant.nr interplayer.c
  6. echo x - phant.nr
  7. sed 's/^X//' > phant.nr << '!EOR!'
  8. X.de sh
  9. X.br
  10. X.ne 5
  11. X.PP
  12. X\fB\\$1\fR
  13. X.PP
  14. X..
  15. X.TH PHANTASIA 6 GAMES
  16. X.UC 4
  17. X.SH NAME
  18. Xphantasia \- an interterminal fantasy game
  19. X.SH SYNOPSIS
  20. X.B phantasia
  21. X[
  22. X.B \-s
  23. X] [
  24. X.B \-m
  25. X] [
  26. X.B \-a
  27. X] [
  28. X.B \-x
  29. X] [
  30. X.B \-h
  31. X] [
  32. X.B \-H
  33. X] [
  34. X.B \-p
  35. X] [
  36. X.B \-b
  37. X] [
  38. X.B \-S
  39. X]
  40. X.SH DESCRIPTION
  41. X.I Phantasia
  42. Xis a role playing game
  43. Xwhich allows players to roll up characters of various types to fight
  44. Xmonsters and other players.
  45. XProgression of characters is based upon gaining experience from fighting
  46. Xmonsters (and other players).
  47. X.PP
  48. XMost of the game is menu driven and self-explanatory (more or less).
  49. XThe screen is cursor updated, so be sure to set up the
  50. X.B TERM
  51. Xvariable in your environment.
  52. X.PP
  53. XThe options provide for a variety of functions to support the game.
  54. XThey are:
  55. X.PP
  56. X.TP .5i
  57. X.B \-s
  58. XInvokes 
  59. X.I phantasia
  60. Xwithout header information.
  61. X.TP .5i
  62. X.B \-m
  63. XGet a monster listing.
  64. X.TP .5i
  65. X.B \-a
  66. XGet a listing of all character names on file.
  67. X.TP .5i
  68. X.B \-x
  69. XExamine/change a particular character on file.
  70. X.TP .5i
  71. X.B \-h
  72. XPrint a help listing (this message).
  73. X.TP .5i
  74. X.B \-H
  75. XPrint header only.
  76. X.TP .5i
  77. X.B \-p
  78. XPurge old characters.
  79. X.TP .5i
  80. X.B \-b
  81. XShow scoreboard of top characters per login.
  82. X.TP .5i
  83. X.B \-S
  84. XTurn on wizard options, if allowed.
  85. X.PP
  86. XThe characters are saved on a common file, in order to make the game
  87. Xinteractive between players.  The characters are given a password
  88. Xin order to retrieve them later.  Only characters above
  89. X.B level
  90. Xzero are saved.  Characters unused for awhile will be purged.
  91. XCharacters are only placed on the scoreboard when they die.
  92. X.SH AUTHOR
  93. XEdward Estes, AT&T Information Systems, Skokie, IL
  94. X.SH PARTICULARS
  95. X.sh "Normal Play"
  96. XA number of the player's more important statistics are almost always
  97. Xdisplyed on the screen, with maximums (where applicable) in
  98. Xparentheses.
  99. X.PP
  100. XThe character is placed randomly near the center of a cartesian
  101. Xsystem.
  102. XMost commands are selected with a single letter or digit.
  103. XFor example, one may move by hitting 'W', 'S', 'N', or 'E',
  104. X(lower case may also be used, at no time is the game case dependent).
  105. XOne may also use 'H', 'J', 'K', 'L',
  106. Xfor movement, similar to
  107. X.IR vi (1).
  108. XTo move to a specific (x, y) coordinate, use the
  109. X.B move
  110. X('1') command.    The distance a character can move is calculated by
  111. X1 plus 1.5 per
  112. X.B level.
  113. XMoving in a compass direction will move the player the maximum
  114. Xallowed distance in that direction.
  115. X.PP
  116. XA player may see who else is playing by using the
  117. X.B players
  118. X('2') option.  One may see the coordinates of those who are the same
  119. Xdistance or closer to the origin as he/she.
  120. X.B Kings,
  121. Xand
  122. X.B council of the wise
  123. Xcan see and can be seen by everyone.  A
  124. X.B palantir
  125. Xremoves these retrictions.
  126. X.PP
  127. XOne can talk to other players with the
  128. X.B talk
  129. X('3') option.  In general, this is a line or so of text.  To remove a current
  130. Xmessage, just type <return> when prompted for a message.
  131. X.PP
  132. XThe
  133. X.B stats
  134. X('4') option shows additional characteristics of a player.
  135. X.PP
  136. XOne may leave the game either with the
  137. X.B quit
  138. X('5') option.
  139. X.PP
  140. XOne may rest by default.  Resting lets one regain maximum
  141. X.B energy level,
  142. Xand also lets one find
  143. X.B mana
  144. X(more is found for larger levels and further distances from the origin).
  145. X.PP
  146. XOne may call a monster by hitting '9' or 'C'.
  147. X.PP
  148. XUse 'X' to examine other players.
  149. X.PP
  150. XOne may quit or execute a sub-shell by hitting interrupt.
  151. XQuitting during battle results in death for obvious reasons.
  152. X.PP
  153. XSeveral other options become available as the player progresses in
  154. X.B level
  155. Xand
  156. X.B magic,
  157. Xor to other stations in the game (
  158. X.B valar, council of the wise, king
  159. X).
  160. XThese are described elsewhere.
  161. XIn general, a control-L will force the redrawing of the screen.
  162. X.PP
  163. XOther things which may happen are more or less self-explanatory.
  164. X.sh "Fighting Monsters"
  165. XA player has several options while fighting monsters.  They are as follows:
  166. X.TP 1.5i
  167. X.B melee
  168. XInflicts damage on the monster, based upon
  169. X.B strength.
  170. XAlso decreases the monster's
  171. X.B strength
  172. Xsome.
  173. X.TP 1.5i
  174. X.B skirmish
  175. XInflicts a little less damage than
  176. X.B melee,
  177. Xbut decreases the monster's
  178. X.B quickness
  179. Xinstead.
  180. X.TP 1.5i
  181. X.B evade
  182. XAttempt to run away.  Success is based upon both the player's and
  183. Xthe monster's
  184. X.B brains
  185. Xand
  186. X.B quickness.
  187. X.TP 1.5i
  188. X.B spell
  189. XSeveral options for throwing spells (described elsewhere).
  190. X.TP 1.5i
  191. X.B nick
  192. XHits the monster one plus the player's
  193. X.B sword,
  194. Xand gives the player 10% of the monster's
  195. X.B experience.
  196. XDecreases the monster's
  197. X.B experience
  198. Xan amount proportional to the amount granted.
  199. XThis also increases the monster's quickness.
  200. XParalyzed monsters wake up very fast when nicked.
  201. X.TP 1.5i
  202. X.B luckout
  203. XThis is essentially a battle of wits with the monster.    Success is based
  204. Xupon the player's and the monster's
  205. X.B brains.
  206. XThe player gets credit for slaying the monster if he/she succeeds.
  207. XOtherwise, nothing happens, and the chance to
  208. X.B luckout
  209. Xis lost.
  210. X.sh "Character Statistics"
  211. X.TP 1.5i
  212. X.B strength
  213. Xdetermines how much damage a character can inflict.
  214. X.TP 1.5i
  215. X.B quickness
  216. Xdetermines how many chances a character gets to make decisions while
  217. Xfighting.
  218. X.TP 1.5i
  219. X.B energy level
  220. Xspecifies how much damage a character may endure before dying.
  221. X.TP 1.5i
  222. X.B magic level
  223. Xdetermines which spells a character may throw, and how effective those
  224. Xspells will be.
  225. X.TP 1.5i
  226. X.B brains
  227. Xbasically, the character's intelligence; used for various fighting options
  228. Xand spells.
  229. X.TP 1.5i
  230. X.B mana
  231. Xused as a power source for throwing spells.
  232. X.TP 1.5i
  233. X.B experience
  234. Xgained by fighting monsters and other characters.
  235. X.TP 1.5i
  236. X.B level
  237. Xindicative of how much experience a character has accumulated; progresses
  238. Xgeometrically as
  239. X.B experience
  240. Xincreases.
  241. X.TP 1.5i
  242. X.B poison
  243. Xsickness which degrades a character's performance (affects
  244. X.B energy level
  245. Xand
  246. X.B strength
  247. X).
  248. X.TP 1.5i
  249. X.B sin
  250. Xaccumulated as a character does certain nasty things; used only rarely
  251. Xin normal play of the game.
  252. X.TP 1.5i
  253. X.B age
  254. Xof player; roughly equivalent to number of turns.
  255. XAs
  256. X.B age
  257. Xincreases, many personal statistics degenerate.
  258. X.sh "Character Types"
  259. XCharacter statistics are rolled randomly from the above list, according
  260. Xto character type.  The types are as follows:
  261. X.TP 1.5i
  262. X.B magic user
  263. Xstrong in
  264. X.B magic level
  265. Xand
  266. X.B brains
  267. X, weak in other areas.    Must rely on wits and magic to survive.
  268. X.TP 1.5i
  269. X.B fighter
  270. Xgood in
  271. X.B strength
  272. Xand
  273. X.B energy level
  274. X, fairly good in other areas.  This adds up to a well-equipped fighter.
  275. X.TP 1.5i
  276. X.B elf
  277. Xvery high
  278. X.B quickness
  279. Xand above average
  280. X.B magic level
  281. Xare
  282. X.B elves
  283. Xselling points.
  284. X.TP 1.5i
  285. X.B dwarf
  286. Xvery high
  287. X.B strength
  288. Xand
  289. X.B energy level
  290. X, but with a tendency to be rather slow and not too bright.
  291. X.TP 1.5i
  292. X.B halfling
  293. Xrather quick and smart, with high
  294. X.B energy level
  295. X, but poor in
  296. X.B magic
  297. Xand
  298. X.B strength.
  299. XBorn with some
  300. X.B experience.
  301. X.TP 1.5i
  302. X.B experimento
  303. Xvery mediocre in all areas.  However, the
  304. X.B experimento
  305. Xmay be placed almost anywhere within the playing grid.
  306. X.PP
  307. XThe possible ranges for starting statistics are summarized in
  308. Xthe following table.
  309. X.PP
  310. X.TS
  311. Xl c c c c c c
  312. Xl c c c c c c.
  313. XType    Strength    Quick    Mana    Energy    Brains    Magic
  314. X_
  315. XMag. User    10-15    30-35    50-100    30-45    60-85    5-9
  316. XFighter    40-55    30-35    30-50    45-70    25-45    3-6
  317. XElf    35-45    32-38    45-90    30-50    40-65    4-7
  318. XDwarf    50-70    25-30    25-45    60-100    20-40    2-5
  319. XHalfling    20-25    34    25-45    55-90    40-75    1-4
  320. XExperimento    25    27    100    35    25    2
  321. X.TE
  322. X.PP
  323. XNot only are the starting characteristics different for the different
  324. Xcharacter types, the characteristics progress at different rates for the
  325. Xdifferent types as the character goes up in
  326. X.B level.  Experimentoes'
  327. Xcharacteristics progress randomly as one of the other types.
  328. XThe progression as characters increase in
  329. X.B level
  330. Xis summarized in the following table.
  331. X.PP
  332. X.TS
  333. Xl c c c c c
  334. Xl n n n n n.
  335. XType    Strength    Mana    Energy    Brains    Magic
  336. X_
  337. XMag. User    2.0    75    20    6    2.75
  338. XFighter    3.0    40    30    3.0    1.5
  339. XElf    2.5    65    25    4.0    2.0
  340. XDwarf    5    30    35    2.5    1
  341. XHalfling    2.0    30    30    4.5    1
  342. X.TE
  343. X.PP
  344. XThe character type also determines how much gold a player may
  345. Xcarry, how long until
  346. X.B rings
  347. Xcan overcome the player, and how much
  348. X.B poison
  349. Xthe player can withstand.
  350. X.sh "Spells"
  351. XDuring the course of the game, the player may exercise his/her
  352. Xmagic powers.  These cases are described below.
  353. X.TP 1.5i
  354. X.B cloak
  355. X.I magic level necessary:
  356. X20 (plus level 7)
  357. X.br
  358. X.I mana used:
  359. X35 plus 3 per rest period
  360. X.br
  361. XUsed during normal play.  Prevents monsters from finding the character,
  362. Xas well as hiding the player from other players.  His/her coordinates
  363. Xshow up as '?' in the
  364. X.B players
  365. Xoption.  Players cannot collect
  366. X.B mana,
  367. Xfind trading posts, or discover the
  368. X.B grail
  369. Xwhile cloaked.    Calling a monster uncloaks, as well as choosing
  370. Xthis option while cloaked.
  371. X.br
  372. X.TP 1.5i
  373. X.B teleport
  374. X.I magic level necessary:
  375. X40 (plus level 12)
  376. X.br
  377. X.I mana used:
  378. X30 per 75 moved
  379. X.br
  380. XUsed during normal play.  Allows the player too move with much more freedom
  381. Xthan with the
  382. X.B move
  383. Xoption, at the price of expending mana.  The maximum distance possible
  384. Xto move is based upon
  385. X.B level
  386. Xand
  387. X.B magic level.
  388. X.TP 1.5i
  389. X.B power blast
  390. X.I magic level necessary:
  391. Xnone
  392. X.br
  393. X.I mana used:
  394. X5 times
  395. X.B level
  396. X.br
  397. XUsed during inter-terminal battle.  Damage is based upon
  398. X.B magic level
  399. Xand
  400. X.B strength.
  401. XHits much harder than a normal hit.
  402. X.TP 1.5i
  403. X.B all or nothing
  404. X.I magic level necessary:
  405. Xnone
  406. X.br
  407. X.I mana used:
  408. X1
  409. X.br
  410. XUsed while combatting monsters.
  411. XHas a 25% chance of working.  If it works it hits the monster just enough
  412. Xto kill it.  If it fails, it doesn't hit the monster, and doubles the
  413. Xmonster's
  414. X.B quickness
  415. Xand
  416. X.B strength.
  417. XParalyzed monsters wake up much quicker as a result of this spell.
  418. X.TP 1.5i
  419. X.B magic bolt
  420. X.I magic level necessary:
  421. X5
  422. X.br
  423. X.I mana used:
  424. Xvariable
  425. X.br
  426. XUsed while combatting monsters.  Hits the monster based upon the amount
  427. Xof
  428. X.B mana
  429. Xexpended and
  430. X.B magic level.
  431. XGuaranteed to hit at least 10 per
  432. X.B mana.
  433. X.TP 1.5i
  434. X.B force field
  435. X.I magic level necessary:
  436. X15
  437. X.br
  438. X.I mana used:
  439. X30
  440. X.br
  441. XUsed during monster combat.  Throws up a shield to protect from damage.
  442. XThe shield is added to actual energy level, and is a fixed number, based
  443. Xupon maximum energy.  Normally, damage occurs first to the shield, and
  444. Xthen to the players actual
  445. X.B energy level.
  446. X.TP 1.5i
  447. X.B transform
  448. X.I magic level necessary:
  449. X25
  450. X.br
  451. X.I mana used:
  452. X50
  453. X.br
  454. XUsed during monster combat.  Transforms the monster randomly into one
  455. Xof the 100 monsters from the monster file.
  456. X.TP 1.5i
  457. X.B increase might
  458. X.I magic level necessary:
  459. X35
  460. X.br
  461. X.I mana used:
  462. X75
  463. X.br
  464. XUsed during combat with monsters.  Increases strength up to a maximum.
  465. X.TP 1.5i
  466. X.B invisibility
  467. X.I magic level necessary:
  468. X45
  469. X.br
  470. X.I mana used:
  471. X90
  472. X.br
  473. XUsed while fighting monsters.  Makes it harder for the monster to hit,
  474. Xby temporarily increasing the player's
  475. X.B quickness.
  476. XThis spell may be thrown several times, but a maximum level will be reached.
  477. X.TP 1.5i
  478. X.B transport
  479. X.I magic level necessary:
  480. X60
  481. X.br
  482. X.I mana used:
  483. X125
  484. X.br
  485. XUsed during monster combat.  Transports the monster away from the
  486. Xplayer.  Success is base upon player's
  487. X.B magic
  488. Xand
  489. X.B brains,
  490. Xand the monster's
  491. X.B experience.
  492. XIf it fails the player is transported instead.    60% of the time, the monster
  493. Xwill drop any treasure it was carrying.
  494. X.TP 1.5i
  495. X.B paralyze
  496. X.I magic level necessary:
  497. X75
  498. X.br
  499. X.I mana used:
  500. X150
  501. X.br
  502. XUsed during monster combat.  "Freezes" the monster by putting its
  503. X.B quickness
  504. Xslightly negative.  The monster will slowly wake up.  Success is based
  505. Xupon player's
  506. X.B magic
  507. Xand the monster's
  508. X.B experience.
  509. XIf it fails, nothing happens.
  510. X.TP 1.5i
  511. X.B specify
  512. X.I magic level necessary:
  513. Xnone
  514. X.br
  515. X.I mana used:
  516. X1000
  517. X.br
  518. XUsed during monster combat only by
  519. X.B valar
  520. Xor
  521. X.B council of the wise.
  522. XAllows the player to pick which monster to fight.
  523. X.sh "Monsters"
  524. XMonsters get bigger as one moves farther from the origin (0,0).  Rings of
  525. Xdistance 125 from the origin determine the size.  A monster's
  526. X.B experience, energy level,
  527. Xand
  528. X.B brains
  529. Xare multiplied by the size.
  530. X.B Strength
  531. Xis increase 50% per size over one, and
  532. X.B quickness
  533. Xremains the same, regardless of size.
  534. X.PP
  535. XAlso, nastier monsters are found as one progress farther out
  536. Xfrom the origin.  Monsters also may flock.  The percent chance of that
  537. Xhappening is designated as
  538. X.B flock%
  539. Xin the monster listing.  Monsters outside the first ring
  540. Xmay carry treasure, as determined by their treasure type.
  541. XFlocking monsters, and bigger monsters increase the chances of treasure.
  542. X.PP
  543. XCertain monsters have special abilities; they are as follows:
  544. X.TP 1.5i
  545. X.B Unicorn
  546. Xcan only be subdued if the player is in possession of a
  547. X.B virgin.
  548. X.TP 1.5i
  549. X.B Modnar
  550. Xhas random characteristics, including treasure type.
  551. X.TP 1.5i
  552. X.B Mimic
  553. Xwill pick another name from the list of monsters in order to
  554. Xconfuse.
  555. X.TP 1.5i
  556. X.B Dark Lord
  557. Xvery nasty person.  Does not like to be hit (especially nicked),
  558. Xand many spells do not work well (or at all) against him.
  559. XOne can always
  560. X.B evade
  561. Xfrom the
  562. X.B Dark Lord.
  563. X.TP 1.5i
  564. X.B Leanan-Sidhe
  565. Xalso a very nasty person.  She will permanently sap
  566. X.B strength
  567. Xfrom someone.
  568. X.TP 1.5i
  569. X.B Saruman
  570. Xwanders around with
  571. X.B Wormtongue
  572. X, who can steal a
  573. X.B palantir.
  574. XAlso,
  575. X.B Saruman
  576. Xmay turn a player's gems into gold pieces,
  577. Xor scramble her/his stats.
  578. X.TP 1.5i
  579. X.B Thaumaturgist
  580. Xcan transport a player.
  581. X.TP 1.5i
  582. X.B Balrog
  583. Xinflicts damage by taking away
  584. X.B experience
  585. X, not
  586. X.B energy.
  587. X.TP 1.5i
  588. X.B Vortex
  589. Xmay take some
  590. X.B mana.
  591. X.TP 1.5i
  592. X.B Nazgul
  593. Xmay try to steal a
  594. X.B ring
  595. Xor neutralize part of one's
  596. X.B brains.
  597. X.TP 1.5i
  598. X.B Tiamat
  599. Xmay take half a players
  600. X.B gold
  601. Xand
  602. X.B gems
  603. Xand escape.
  604. X.TP 1.5i
  605. X.B Kobold
  606. Xmay get nasty and steal one gold piece and run away.
  607. X.TP 1.5i
  608. X.B Shelob
  609. Xmay bite, inflicting the equivalent of one
  610. X.B poison.
  611. X.TP 1.5i
  612. X.B Assorted Faeries
  613. XThese are killed if attacking someone carrying
  614. X.B holy water.
  615. XThese are
  616. X.B Cluricaun, Fir Darrig, Fachan,
  617. X.B Ghille Dhu, Bogle, Killmoulis,
  618. Xand
  619. X.B Bwca.
  620. X.TP 1.5i
  621. X.B Lamprey
  622. Xmay bite, inflicting 1/2 of a
  623. X.B poison.
  624. X.TP 1.5i
  625. X.B Shrieker
  626. Xwill call one of its (much bigger) buddies if picked upon.
  627. X.TP 1.5i
  628. X.B Bonnacon
  629. Xwill become bored with battle, fart, and run off.
  630. X.TP 1.5i
  631. X.B Smeagol
  632. Xwill try to steal a
  633. X.B ring
  634. Xfrom a player, if given the chance.
  635. X.TP 1.5i
  636. X.B Succubus
  637. Xmay inflict damage through a
  638. X.B force field.
  639. XThis subtracts from
  640. X.B energy level
  641. Xinstead of any shield the player may have thrown up.
  642. XThis is a very easy way to die.
  643. X.TP 1.5i
  644. X.B Cerberus
  645. Xloves metal and will steal all the metal treasures from
  646. Xa player if able.
  647. X.TP 1.5i
  648. X.B Ungoliant
  649. Xcan bite and poison.  This inflicts five
  650. X.B poisons
  651. X, and also takes one from the player's
  652. X.B quickness.
  653. X.TP 1.5i
  654. X.B Jabberwock
  655. Xmay tire of battle, and leave after calling one of his friends
  656. X(
  657. X.B Jubjub Bird
  658. Xor
  659. X.B Bandersnatch
  660. X).
  661. X.TP 1.5i
  662. X.B Morgoth
  663. Xactually
  664. X.B Modnar
  665. X, but reserved for
  666. X.B council of the wise, valar,
  667. Xand
  668. X.B ex-valar.
  669. XFights with
  670. X.B Morgoth
  671. Xend when either he or the player dies.    His characteristics
  672. Xare calculated based upon the player's.  The player is given
  673. Xthe chance to ally with him.  No magic, except
  674. X.B force field
  675. Xworks when battling
  676. X.B Morgoth.
  677. X.TP 1.5i
  678. X.B Troll
  679. Xmay regenerate its
  680. X.B energy
  681. Xand
  682. X.B strength
  683. Xwhile in battle.
  684. X.TP 1.5i
  685. X.B Wraith
  686. Xmay make a player blind.
  687. X.sh "Treasures"
  688. XThe various treasure types are as follows:
  689. X.TP 1.5i
  690. X.B Type zero
  691. X.I none
  692. X.TP 1.5i
  693. X.B Type one
  694. X.I power booster
  695. X\- adds mana.
  696. X.br
  697. X.I druid
  698. X\- adds experience.
  699. X.br
  700. X.I holy orb
  701. X\- subtracts 0.25 sin.
  702. X.TP 1.5i
  703. X.B Type two
  704. X.I amulet
  705. X\- protects from cursed treasure.
  706. X.br
  707. X.I holy water
  708. X\- kills
  709. X.B assorted faeries.
  710. X.br
  711. X.I hermit
  712. X\- reduces sin by 25% and adds some mana.
  713. X.TP 1.5i
  714. X.B Type three
  715. X.I shield
  716. X\- adds to maximum
  717. X.B energy level
  718. X.br
  719. X.I virgin
  720. X\- used to subdue a
  721. X.B unicorn
  722. X, or to give much
  723. X.B experience
  724. X(and some
  725. X.B sin
  726. X).
  727. X.br
  728. X.I athelas
  729. X\- subtracts one
  730. X.B poison.
  731. X.TP 1.5i
  732. X.B Type four (scrolls)
  733. X.I shield
  734. X\- throws a bigger than normal
  735. X.B force field.
  736. X.br
  737. X.I invisible
  738. X\- temporarily puts the finder's
  739. X.B quickness
  740. Xto one million.
  741. X.br
  742. X.I ten fold strength
  743. X\- multiplies finder's strength by ten.
  744. X.br
  745. X.I pick monster
  746. X\- allows finder to pick next monster to battle.
  747. X.br
  748. X.I general knowledge
  749. X\- adds to finder's
  750. X.B brains
  751. Xand
  752. X.B magic level.
  753. X.PP
  754. XAll the scrolls except
  755. X.B general knowledge
  756. Xautomatically call a monster.  These preserve any
  757. Xspells that were already in effect, but are only in
  758. Xeffect while in battle.
  759. X.TP 1.5i
  760. X.B Type five
  761. X.I dagger
  762. X\- adds to
  763. X.B strength.
  764. X.br
  765. X.I armour
  766. X\- same as a
  767. X.B shield,
  768. Xbut bigger.
  769. X.br
  770. X.I tablet
  771. X\- adds brains.
  772. X.TP 1.5i
  773. X.B Type six
  774. X.I priest
  775. X\- rests to maximum; adds 
  776. X.B mana, brains;
  777. Xand halves
  778. X.B sin.
  779. X.br
  780. X.I Robin Hood
  781. X\- increases
  782. X.B shield
  783. Xand adds permanently to
  784. X.B strength.
  785. X.br
  786. X.I axe
  787. X\- like
  788. X.B dagger,
  789. Xbut bigger.
  790. X.TP 1.5i
  791. X.B Type seven
  792. X.I charm
  793. X\- protects from cursed treasure (used before
  794. X.B amulet
  795. X); used in conjunction with
  796. X.B blessing
  797. Xto battle
  798. X.B Dark Lord.
  799. X.br
  800. X.I Merlyn
  801. X\- adds
  802. X.B brains, magic,
  803. Xand
  804. X.B mana.
  805. X.br
  806. X.I war hammer
  807. X\- like an
  808. X.B axe,
  809. Xbut bigger.
  810. X.TP 1.5i
  811. X.B Type eight
  812. X.I healing potion
  813. X\- sets
  814. X.B poison
  815. Xto -2, or subtracts two from
  816. X.B poison,
  817. Xwhichever is better.
  818. X.br
  819. X.I transporter
  820. X\- allows finder to move anywhere.
  821. X.br
  822. X.I sword
  823. X\- like a
  824. X.B war hammer
  825. X, but bigger.
  826. X.TP 1.5i
  827. X.B Type nine
  828. X.I golden crown
  829. X\- allows the player to become
  830. X.B king,
  831. Xby going to (0,0).
  832. X.br
  833. X.I blessing
  834. X\- cuts
  835. X.B sin
  836. Xto 1/3, adds
  837. X.B mana,
  838. Xrests to max., kills
  839. X.B Dark Lord
  840. Xwith a
  841. X.B charm,
  842. Xand gives bearer first hit on all monsters.
  843. X.br
  844. X.I quicksilver
  845. X\- adds to 
  846. X.B quickness.
  847. X.TP 1.5i
  848. X.B Type ten
  849. X.I elven boots
  850. X\- adds permanently to
  851. X.B quickness.
  852. X.TP 1.5i
  853. X.B Type eleven
  854. X.I palantir
  855. X\- allows one to see all the other players; used by
  856. X.B council of the wise
  857. Xto seek the
  858. X.B grail.
  859. X.TP 1.5i
  860. X.B Type twelve/thirteen
  861. X.I ring
  862. X\- allows one to hit much harder in battle, etc.
  863. X.PP
  864. XAny treasure type 10-13 monsters may instead carry a type nine treasure.
  865. X.PP
  866. XA monster may also be carrying
  867. X.B gold
  868. Xor
  869. X.B gems.
  870. XThese are used at
  871. X.B trading posts
  872. Xto buy things.    A
  873. X.B gem
  874. Xis worth 1000 gold pieces.  Too much
  875. X.B gold
  876. Xwill slow a player down.  One may carry 1000 plus 200 per
  877. X.B level
  878. Xof
  879. X.B gold.
  880. XA
  881. X.B gem
  882. Xweighs one half a gold piece.
  883. XMonsters of treasure type 7 or higher may carry
  884. X.B gems.
  885. X.PP
  886. XThe chance of a cursed treasure is based upon treasure type.
  887. XThe more valuable treasures have a greater chance of being cursed.
  888. XA cursed treasure knocks
  889. X.B energy level
  890. Xvery low, and adds 0.25
  891. X.B poison.
  892. X.sh "Rings"
  893. X.B Rings
  894. Xare only carried by
  895. X.B nazguls
  896. Xand
  897. X.B Dark Lord.
  898. XThey come in four different flavors.
  899. XAll
  900. X.B rings
  901. Xrest the player to maximum and cause him/her to hit much harder
  902. Xin battle with monsters (assuming one has chosen to use the
  903. X.B ring
  904. Xfor battle.)
  905. X.PP
  906. XTwo types of
  907. X.B rings
  908. Xare cursed and come either from
  909. X.B nazguls
  910. Xor
  911. X.B Dark Lord.
  912. XAfter a few times of using these types, the player falls
  913. Xunder the control of the
  914. X.B ring,
  915. Xand strange, random things will occur.
  916. XEventually, the player dies, and gives his/her name to a monster
  917. Xon the file.
  918. XDying before the
  919. X.B ring
  920. Xis used up also renames the monster.
  921. X.PP
  922. XThe two remaining types of
  923. X.B rings
  924. Xare much more benign.
  925. XThe one from a
  926. X.B nazgul
  927. Xis good for a limited number of battle rounds, and will save
  928. Xthe player from death if it was being used when he/she died.
  929. XThe one from
  930. X.B Dark Lord
  931. Xis the same, except that it never is used up.
  932. X.B rings
  933. Xdisappear after saving someone from death.
  934. XIn general, cursed
  935. X.B rings
  936. Xoccur much more often than normal ones.
  937. XIt is usually not a good idea to pick one up.
  938. XThe only way to get rid of a
  939. X.B ring
  940. Xis to have a monster steal it.
  941. X.sh "King"
  942. XA player may become
  943. X.B king by finding a
  944. X.I crown
  945. Xand going to (0,0).  Players must have a
  946. X.B level
  947. Xin the range of 10 to 1000 to be able to find a
  948. X.I crown.
  949. XWhen a player with one or more
  950. X.I crowns
  951. Xreaches
  952. X.B level
  953. X1000, the
  954. X.I crowns
  955. Xare converted to
  956. X.I gold.
  957. X.PP
  958. XOnce a player is king, he/she may do certain things while in 
  959. Xthe Lord's Chamber (0,0).  These are exercised with the
  960. X.B decree
  961. X('0') option.
  962. X.TP 1.5i
  963. X.I transport
  964. XThis is done to another player.  It randomly moves the affected
  965. Xplayer about.  A
  966. X.B charm
  967. Xprotects from transports.
  968. X.TP 1.5i
  969. X.I curse
  970. XThis is done to another player.  It is analogous to cursed treasure,
  971. Xbut worse.  It inflicts two
  972. X.B poison,
  973. Xknocks
  974. X.B energy level
  975. Xvery low, and degrades the maximum energy.  It also
  976. Xremoves a
  977. X.B cloak.
  978. XA
  979. X.B blessing
  980. Xprotects from king's curses.
  981. X.TP 1.5i
  982. X.I energy void
  983. XThe king may put a number these scattered about
  984. Xhis/her kingdom as he/she pleases.
  985. XIf a player hits one, he/she loses
  986. X.B mana, energy,
  987. Xand
  988. X.B gold.
  989. XThe energy void disappears after being hit.
  990. X.TP 1.5i
  991. X.I bestow
  992. XThis is also done to another player.  The king may
  993. Xwish to reward one or more loyal subjects by sharing his/her
  994. Xriches (
  995. X.B gold
  996. X).  Or it is a convenient way to dispose of some unwanted
  997. Xdeadweight.
  998. X.TP 1.5i
  999. X.I collect taxes
  1000. XEveryone pays 7% tax on all
  1001. X.B gold
  1002. Xand
  1003. X.B gems
  1004. Xacquired, regardless of the existence of a
  1005. X.B king.
  1006. XThe king collects the accrued taxes with this option.
  1007. X.PP
  1008. XThe
  1009. X.B king
  1010. Xmay also 
  1011. X.B teleport
  1012. Xanywhere for free by using the origin as a starting place.
  1013. X.sh "Council of the Wise, Valar"
  1014. XA player automatically becomes a member of the
  1015. X.B council of the wise
  1016. Xupon reaching level 3000.  Members of the council cannot have
  1017. X.B rings.
  1018. XMembers of the council have a few extra options which they can exercise.
  1019. XThese are exercised
  1020. X.B intervene
  1021. X('8') option.
  1022. XAll
  1023. X.B intervene
  1024. Xoptions cost 1000 mana.
  1025. XOne
  1026. X.B intervene
  1027. Xoption is to
  1028. X.I heal
  1029. Xanother player.  This is just a quick way for that player to be rested
  1030. Xto maximum and lose a little
  1031. X.B poison.
  1032. XThe main purpose in life for members of the council is to seek the
  1033. X.B Holy Grail.
  1034. XThis is done with a
  1035. X.B palantir
  1036. Xunder the
  1037. X.I seek grail
  1038. Xoption.  The distance cited by the seek is accurate within 10%, in order
  1039. Xnot to make it too easy to find the grail.
  1040. XA player must have infintesimally small
  1041. X.B sin,
  1042. Xor else it's all over upon finding the grail.
  1043. XIn order to help members of the council on their quest, they
  1044. Xmay
  1045. X.I teleport
  1046. Xwith greater ease.
  1047. X.PP
  1048. XUpon finding the grail, the player advance to position of
  1049. X.B valar.
  1050. XHe/she may then exercise more and niftier options under
  1051. X.I intervention.
  1052. XThese include all of the council members' option plus the
  1053. Xability to move other players about, bless them, and throw monsters at
  1054. Xthem.
  1055. XA
  1056. X.BR valar 's
  1057. Xblessing has the same effect as the treasure
  1058. X.I blessing,
  1059. Xexcept that the affected player does not get his/her
  1060. X.I blessing
  1061. Xflag set.
  1062. XAll
  1063. X.I intervention
  1064. Xoptions which affect other players age the player
  1065. Xwho uses them.
  1066. X.B Valar
  1067. Xare essentially immortal, but are actually given five lives.
  1068. XIf these are used up, the player is left to die, and becomes an
  1069. X.B ex-valar.
  1070. X.B Valar
  1071. Xcannot
  1072. X.I move, teleport,
  1073. Xor call monsters.
  1074. X(An exception to this is if the
  1075. X.I valar
  1076. Xfinds a
  1077. X.I transporter.
  1078. XThis is to allow him/her to dispose of excess
  1079. X.I gold.
  1080. XAny monsters which a
  1081. X.B valar
  1082. Xencounters are based upon his/her size.
  1083. XOnly one valar may exists at a time.
  1084. XThe current valar is replaced when another player finds the grail.
  1085. XThe valar is then bumped back to the council of the wise.
  1086. X.sh "Wizard"
  1087. XThe
  1088. X.I wizard
  1089. Xis usually the owner of the game, and the one who maintains
  1090. Xthe associated files.
  1091. XThe
  1092. X.I wizard
  1093. Xis granted special powers within the game, if it is invoked
  1094. Xwith the '\-S' option.
  1095. XOtherwise, the
  1096. X.I wizard
  1097. Xplays no different from other players.
  1098. XThe
  1099. X.I wizard
  1100. Xabilities are outlined below.
  1101. X.TP
  1102. X.I change players
  1103. XWhen examining a player, (game invoked with '-x', or use 'X' from within game),
  1104. Xthe
  1105. X.I wizard
  1106. Xmay also change the player.
  1107. X.TP
  1108. X.I intervention
  1109. XThe
  1110. X.I wizard
  1111. Xmay do all the
  1112. X.I intervention
  1113. Xoptions.  One extra option,
  1114. X.I vaporize,
  1115. Xis added to kill any offensive players.
  1116. X.TP
  1117. X.I super character type
  1118. XAn extra character type is added.  This character starts with the
  1119. Xmaximum possible in all statistics, selected from the other character types.
  1120. XA
  1121. X.B super
  1122. Xcharacter's statistics also progress at the maximum possible rate, selected
  1123. Xfrom the other character types.
  1124. X.sh "Special Places"
  1125. XCertain regions of the playing grid have different names.
  1126. XIn general, this is only to give the player some idea of
  1127. Xhis/her present location.  Some special places do exist.
  1128. X.TP 1.5i
  1129. X.I Trading Posts
  1130. XThese are located at |x| == |y| == n*n*100 for n = 1, 2...1000.
  1131. XTrading posts farther out have more things for sale.
  1132. XBe careful about cheating the merchants there, as they have short
  1133. Xtempers.
  1134. XMerchants are dishonest about 5% of the time.
  1135. X.TP 1.5i
  1136. X.I Lord's Chamber
  1137. XThis is located at (0,0).  Only players with
  1138. X.B crowns
  1139. Xmay enter.
  1140. X.TP 1.5i
  1141. X.I Point of No Return
  1142. XThis is located beyond 1.2e+6 in any direction.
  1143. XThe only way to return from here is a
  1144. X.B transporter
  1145. Xor to have a
  1146. X.B valar
  1147. Xrelocate the player.
  1148. X.TP 1.5i
  1149. X.I Dead Marshes
  1150. XThis is a band located fairly distant from the origin.    The first
  1151. Xfourteen monsters (water monsters) can normally only be found here.
  1152. X.TP 1.5i
  1153. X.I Valhala
  1154. XThis place is where the
  1155. X.B valar
  1156. Xresides.  It is associated with no particular coordinate on the
  1157. Xplaying grid.
  1158. X.TP 1.5i
  1159. X.sh "Miscellaneous"
  1160. XOnce a player reaches
  1161. X.B level
  1162. X5, the game will start to time out waiting for input.
  1163. XThis is to try to keep the game a bit faster paced.
  1164. X.PP
  1165. XA
  1166. X.I guru
  1167. Xwill never be disgusted with your
  1168. X.B sins
  1169. Xif they are less than one.
  1170. X.PP
  1171. XA
  1172. X.I medic
  1173. Xwants half of a player's
  1174. X.B gold
  1175. Xto be happy.  Offering more than one has, or a negative amount
  1176. Xwill anger the
  1177. X.I medic,
  1178. Xwho will make the player worse (add one
  1179. X.B poison
  1180. X).
  1181. X.PP
  1182. XThe
  1183. X.B Holy Grail
  1184. Xdoes little for those who are not ready to behold it.
  1185. XWhenever anyone finds it, it moves.
  1186. XIt is always located within 1e+6 in any compass direction of the origin.
  1187. X.PP
  1188. XThere is a maximum amount of
  1189. X.B mana
  1190. Xand
  1191. X.B charms
  1192. Xa player may posses, based upon
  1193. X.B level.
  1194. X.I Quicksilver
  1195. Xis always limited to to a maximum of 99.
  1196. X.PP
  1197. X.I Books
  1198. Xbought at a
  1199. X.B trading post
  1200. Xincrease 
  1201. X.B brains,
  1202. Xbased upon the number bought.
  1203. XIt is unwise, however to buy more than 1/10 of one's
  1204. X.B level
  1205. Xin books at a time.
  1206. X.PP
  1207. XPlayers over level 10000 are automatically retired.
  1208. X.PP
  1209. XA
  1210. X.I blindness
  1211. Xgoes away in random time.
  1212. X.PP
  1213. XPlayers with
  1214. X.I crowns
  1215. Xare identified with a '*' before their character type.
  1216. X.sh "Inter-terminal Battle"
  1217. XWhen two player's coordinates correspond, they may engage in battle.
  1218. XIn general, the player with the highest
  1219. X.B quickness
  1220. Xgets the first hit.
  1221. XIf the two players are severely mis-matched, the stronger player
  1222. Xis drastically handicapped for the battle.
  1223. XIn order to protect from being stuck in an infinite loop,
  1224. Xthe player waiting for response may time out.  Options for battle are:
  1225. X.TP 1.5i
  1226. X.I fight
  1227. XInflicts damage upon other person.
  1228. X.TP 1.5i
  1229. X.I run away
  1230. XEscape from battle.  Has a 75% chance of working.
  1231. X.TP 1.5i
  1232. X.I power blast
  1233. XBattle spell.
  1234. X.TP 1.5i
  1235. X.I luckout
  1236. XOne-time chance to try to win against the foe.    Has a 10% chance of working.
  1237. X.PP
  1238. XSometimes waits for the other player may be excessive, because
  1239. Xhe/she may be battling a monster.  Upon slaying a player in battle
  1240. Xthe winner gets the other's
  1241. X.B experience
  1242. Xand treasures.
  1243. X.B Rings
  1244. Xdo not work for inter-terminal battle.
  1245. X.SH BUGS
  1246. XAll screen formats assumme at least 24 lines by at least 80 columns.
  1247. XNo provisions are made for when any of the data items get too big
  1248. Xfor the allotted space on the screen.
  1249. !EOR!
  1250. echo x - interplayer.c
  1251. sed 's/^X//' > interplayer.c << '!EOR!'
  1252. X/*
  1253. X * interplayer.c - player to player routines for Phantasia
  1254. X */
  1255. X
  1256. X#include "include.h"
  1257. X
  1258. X/************************************************************************
  1259. X/
  1260. X/ FUNCTION NAME: checkbattle()
  1261. X/
  1262. X/ FUNCTION: check to see if current player should battle another
  1263. X/
  1264. X/ AUTHOR: E. A. Estes, 12/4/85
  1265. X/
  1266. X/ ARGUMENTS: none
  1267. X/
  1268. X/ RETURN VALUE: none
  1269. X/
  1270. X/ MODULES CALLED: battleplayer(), fread(), fseek()
  1271. X/
  1272. X/ GLOBAL INPUTS: Other, Users, Player, Fileloc, *Playersfp
  1273. X/
  1274. X/ GLOBAL OUTPUTS: Users
  1275. X/
  1276. X/ DESCRIPTION:
  1277. X/    Seach player file for a foe at the same coordinates as the
  1278. X/    current player.
  1279. X/    Also update user count.
  1280. X/
  1281. X/************************************************************************/
  1282. X
  1283. Xcheckbattle()
  1284. X{
  1285. Xlong    foeloc = 0L;        /* location in file of person to fight */
  1286. X
  1287. X    Users = 0;
  1288. X    fseek(Playersfp, 0L, 0);
  1289. X
  1290. X    while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
  1291. X    {
  1292. X    if (Other.p_status != S_OFF
  1293. X        && Other.p_status != S_NOTUSED
  1294. X        && Other.p_status != S_HUNGUP
  1295. X        && (Other.p_status != S_CLOAKED || Other.p_specialtype != SC_VALAR))
  1296. X        /* player is on and not a cloaked valar */
  1297. X        {
  1298. X        ++Users;
  1299. X
  1300. X        if (Player.p_x == Other.p_x
  1301. X        && Player.p_y == Other.p_y
  1302. X        /* same coordinates */
  1303. X        && foeloc != Fileloc
  1304. X        /* not self */
  1305. X        && Player.p_status == S_PLAYING
  1306. X        && (Other.p_status == S_PLAYING || Other.p_status == S_INBATTLE)
  1307. X        /* both are playing */
  1308. X        && Other.p_specialtype != SC_VALAR
  1309. X        && Player.p_specialtype != SC_VALAR)
  1310. X        /* neither is valar */
  1311. X        {
  1312. X        battleplayer(foeloc);
  1313. X        return;
  1314. X        }
  1315. X        }
  1316. X    foeloc += SZ_PLAYERSTRUCT;
  1317. X    }
  1318. X}
  1319. X/* */
  1320. X/************************************************************************
  1321. X/
  1322. X/ FUNCTION NAME: battleplayer()
  1323. X/
  1324. X/ FUNCTION: inter-terminal battle with another player
  1325. X/
  1326. X/ AUTHOR: E. A. Estes, 2/15/86
  1327. X/
  1328. X/ ARGUMENTS:
  1329. X/    long foeplace - location in player file of person to battle
  1330. X/
  1331. X/ RETURN VALUE: none
  1332. X/
  1333. X/ MODULES CALLED: readrecord(), readmessage(), writerecord(), collecttaxes(), 
  1334. X/    displaystats(), fabs(), more(), death(), sleep(), wmove(), waddch(), printw(), 
  1335. X/    myturn(), altercoordinates(), waddstr(), wrefresh(), mvprintw(), 
  1336. X/    getanswer(), wclrtoeol(), wclrtobot()
  1337. X/
  1338. X/ GLOBAL INPUTS: Foestrikes, LINES, Lines, Other, Shield, Player, *stdscr, 
  1339. X/    Fileloc, *Enemyname
  1340. X/
  1341. X/ GLOBAL OUTPUTS: Foestrikes, Lines, Shield, Player, Luckout, *Enemyname
  1342. X/
  1343. X/ DESCRIPTION:
  1344. X/    Inter-terminal battle is a very fragile and slightly klugy thing.
  1345. X/    At any time, one player is master and the other is slave.
  1346. X/    We pick who is master first by speed and level.  After that,
  1347. X/    the slave waits for the master to relinquish its turn, and
  1348. X/    the slave becomes master, and so on.
  1349. X/
  1350. X/    The items in the player structure which control the handshake are:
  1351. X/        p_tampered:
  1352. X/        master increments this to relinquish control
  1353. X/        p_istat:
  1354. X/        master sets this to specify particular action
  1355. X/        p_1scratch:
  1356. X/        set to total damage inflicted so far; changes to indicate action
  1357. X/
  1358. X/************************************************************************/
  1359. X
  1360. Xbattleplayer(foeplace)
  1361. Xlong    foeplace;
  1362. X{
  1363. Xdouble    dtemp;        /* for temporary calculations */
  1364. Xdouble    oldhits = 0.0;    /* previous damage inflicted by foe */
  1365. Xregister int    loop;    /* for timing out */
  1366. Xint    ch;        /* input */
  1367. Xshort    oldtampered;    /* old value of foe's p_tampered */
  1368. X
  1369. X    Lines = 8;
  1370. X    Luckout = FALSE;
  1371. X    mvaddstr(4, 0, "Preparing for battle!\n");
  1372. X    refresh();
  1373. X
  1374. X#ifdef SYS5
  1375. X    flushinp();
  1376. X#endif
  1377. X
  1378. X    /* set up variables, file, etc. */
  1379. X    Player.p_status = S_INBATTLE;
  1380. X    Shield = Player.p_energy;
  1381. X
  1382. X    /* if p_tampered is not 0, someone else may try to change it (king, etc.) */
  1383. X    Player.p_tampered = oldtampered = 1;
  1384. X    Player.p_1scratch = 0.0;
  1385. X    Player.p_istat = I_OFF;
  1386. X
  1387. X    readrecord(&Other, foeplace);
  1388. X    if (fabs(Player.p_level - Other.p_level) > 20.0)
  1389. X    /* see if players are greatly mismatched */
  1390. X    {
  1391. X    dtemp = (Player.p_level - Other.p_level) / MAX(Player.p_level, Other.p_level);
  1392. X    if (dtemp < -0.5)
  1393. X        /* foe outweighs this one */
  1394. X        Player.p_speed *= 2.0;
  1395. X    }
  1396. X
  1397. X    writerecord(&Player, Fileloc);        /* write out all our info */
  1398. X
  1399. X    if (Player.p_blindness)
  1400. X    Enemyname = "someone";
  1401. X    else
  1402. X    Enemyname = Other.p_name;
  1403. X
  1404. X    mvprintw(6, 0, "You have encountered %s   Level: %.0f\n", Enemyname, Other.p_level);
  1405. X    refresh();
  1406. X
  1407. X    for (loop = 0; Other.p_status != S_INBATTLE && loop < 30; ++loop)
  1408. X    /* wait for foe to respond */
  1409. X    {
  1410. X    readrecord(&Other, foeplace);
  1411. X    sleep(1);
  1412. X    }
  1413. X
  1414. X    if (Other.p_status != S_INBATTLE)
  1415. X    /* foe did not respond */
  1416. X    {
  1417. X    mvprintw(5, 0, "%s is not responding.\n", Enemyname);
  1418. X    goto LEAVE;
  1419. X    }
  1420. X    /* else, we are ready to battle */
  1421. X
  1422. X    move(4, 0);
  1423. X    clrtoeol();
  1424. X
  1425. X    /*
  1426. X     * determine who is first master
  1427. X     * if neither player is faster, check level
  1428. X     * if neither level is greater, battle is not allowed
  1429. X     * (this should never happen, but we have to handle it)
  1430. X     */
  1431. X    if (Player.p_speed > Other.p_speed)
  1432. X    Foestrikes = FALSE;
  1433. X    else if (Other.p_speed > Player.p_speed)
  1434. X    Foestrikes = TRUE;
  1435. X    else if (Player.p_level > Other.p_level)
  1436. X    Foestrikes = FALSE;
  1437. X    else if (Other.p_level > Player.p_level)
  1438. X    Foestrikes = TRUE;
  1439. X    else
  1440. X    /* no one is faster */
  1441. X    {
  1442. X    printw("You can't fight %s yet.", Enemyname);
  1443. X    goto LEAVE;
  1444. X    }
  1445. X
  1446. X    for (;;)
  1447. X    {
  1448. X    displaystats();
  1449. X    readmessage();
  1450. X    mvprintw(1, 26, "%20.0f", Shield);    /* overprint energy */
  1451. X
  1452. X    if (!Foestrikes)
  1453. X        /* take action against foe */
  1454. X        myturn();
  1455. X    else
  1456. X        /* wait for foe to take action */
  1457. X        {
  1458. X        mvaddstr(4, 0, "Waiting...\n");
  1459. X        clrtoeol();
  1460. X        refresh();
  1461. X
  1462. X        for (loop = 0; loop < 20; ++loop)
  1463. X        /* wait for foe to act */
  1464. X        {
  1465. X        readrecord(&Other, foeplace);
  1466. X        if (Other.p_1scratch != oldhits)
  1467. X            /* p_1scratch changes to indicate action */
  1468. X            break;
  1469. X        else
  1470. X            /* wait and try again */
  1471. X            {
  1472. X            sleep(1);
  1473. X            addch('.');
  1474. X            refresh();
  1475. X            }
  1476. X        }
  1477. X
  1478. X        if (Other.p_1scratch == oldhits)
  1479. X        {
  1480. X        /* timeout */
  1481. X        mvaddstr(22, 0, "Timeout: waiting for response.  Do you want to wait ? ");
  1482. X        ch = getanswer("NY", FALSE);
  1483. X        move(22, 0);
  1484. X        clrtobot();
  1485. X        if (ch == 'Y')
  1486. X            continue;
  1487. X        else
  1488. X            break;
  1489. X        }
  1490. X        else
  1491. X        /* foe took action */
  1492. X        {
  1493. X        switch (Other.p_istat)
  1494. X            {
  1495. X            case I_RAN:        /* foe ran away */
  1496. X            mvprintw(Lines++, 0, "%s ran away!", Enemyname);
  1497. X            break;
  1498. X
  1499. X            case I_STUCK:    /* foe tried to run, but couldn't */
  1500. X            mvprintw(Lines++, 0, "%s tried to run away.", Enemyname);
  1501. X            break;
  1502. X
  1503. X            case I_BLEWIT:    /* foe tried to luckout, but didn't */
  1504. X            mvprintw(Lines++, 0, "%s tried to luckout!", Enemyname);
  1505. X            break;
  1506. X
  1507. X            default:
  1508. X            dtemp = Other.p_1scratch - oldhits;
  1509. X            mvprintw(Lines++, 0, "%s hit you %.0f times!", Enemyname, dtemp);
  1510. X            Shield -= dtemp;
  1511. X            break;
  1512. X            }
  1513. X
  1514. X        oldhits = Other.p_1scratch;    /* keep track of old hits */
  1515. X
  1516. X        if (Other.p_tampered != oldtampered)
  1517. X            /* p_tampered changes to relinquish turn */
  1518. X            {
  1519. X            oldtampered = Other.p_tampered;
  1520. X            Foestrikes = FALSE;
  1521. X            }
  1522. X        }
  1523. X        }
  1524. X
  1525. X    /* decide what happens next */
  1526. X    refresh();
  1527. X    if (Lines > LINES - 2)
  1528. X        {
  1529. X        more(Lines);
  1530. X        move(Lines = 8, 0);
  1531. X        clrtobot();
  1532. X        }
  1533. X
  1534. X    if (Other.p_istat == I_KILLED || Shield < 0.0)
  1535. X        /* we died */
  1536. X        {
  1537. X        Shield = -2.0;        /* insure this value is negative */
  1538. X        break;
  1539. X        }
  1540. X
  1541. X    if (Player.p_istat == I_KILLED)
  1542. X        /* we killed foe; award treasre */
  1543. X        {
  1544. X        mvprintw(Lines++, 0, "You killed %s!", Enemyname);
  1545. X        Player.p_experience += Other.p_experience;
  1546. X        Player.p_crowns += (Player.p_level < 1000.0) ? Other.p_crowns : 0;
  1547. X        Player.p_amulets += Other.p_amulets;
  1548. X        Player.p_charms += Other.p_charms;
  1549. X        collecttaxes(Other.p_gold, Other.p_gems);
  1550. X        Player.p_sword = MAX(Player.p_sword, Other.p_sword);
  1551. X        Player.p_shield = MAX(Player.p_shield, Other.p_shield);
  1552. X        Player.p_quksilver = MAX(Player.p_quksilver, Other.p_quksilver);
  1553. X        if (Other.p_virgin && !Player.p_virgin)
  1554. X        {
  1555. X        mvaddstr(Lines++, 0, "You have rescued a virgin.  Will you be honorable ? ");
  1556. X        if ((ch = getanswer("YN", FALSE)) == 'Y')
  1557. X            Player.p_virgin = TRUE;
  1558. X        else
  1559. X            {
  1560. X            ++Player.p_sin;
  1561. X            Player.p_experience += 8000.0;
  1562. X            }
  1563. X        }
  1564. X        sleep(3);             /* give other person time to die */
  1565. X        break;
  1566. X        }
  1567. X    else if (Player.p_istat == I_RAN || Other.p_istat == I_RAN)
  1568. X        /* either player ran away */
  1569. X        break;
  1570. X    }
  1571. X
  1572. XLEAVE:
  1573. X    /* clean up things and leave */
  1574. X    writerecord(&Player, Fileloc);    /* update a final time */
  1575. X    altercoordinates(0.0, 0.0, A_NEAR);    /* move away from battle site */
  1576. X    Player.p_energy = Shield;        /* set energy to actual value */
  1577. X    Player.p_tampered = T_OFF;        /* clear p_tampered */
  1578. X
  1579. X    more(Lines);            /* pause */
  1580. X
  1581. X    move(4, 0);
  1582. X    clrtobot();                /* clear bottom area of screen */
  1583. X
  1584. X    if (Player.p_energy < 0.0)
  1585. X    /* we are dead */
  1586. X    death("Interterminal battle");
  1587. X}
  1588. X/* */
  1589. X/************************************************************************
  1590. X/
  1591. X/ FUNCTION NAME: myturn()
  1592. X/
  1593. X/ FUNCTION: process players action against foe in battle
  1594. X/
  1595. X/ AUTHOR: E. A. Estes, 2/7/86
  1596. X/
  1597. X/ ARGUMENTS: none
  1598. X/
  1599. X/ RETURN VALUE: none
  1600. X/
  1601. X/ MODULES CALLED: writerecord(), inputoption(), floor(), wmove(), random(), 
  1602. X/    waddstr(), wrefresh(), mvprintw(), wclrtoeol(), wclrtobot()
  1603. X/
  1604. X/ GLOBAL INPUTS: Lines, Other, Player, *stdscr, Fileloc, Luckout, 
  1605. X/    *Enemyname
  1606. X/
  1607. X/ GLOBAL OUTPUTS: Foestrikes, Lines, Player, Luckout
  1608. X/
  1609. X/ DESCRIPTION:
  1610. X/    Take action action against foe, and decide who is master
  1611. X/    for next iteration.
  1612. X/
  1613. X/************************************************************************/
  1614. X
  1615. Xmyturn()
  1616. X{
  1617. Xdouble    dtemp;        /* for temporary calculations */
  1618. Xint    ch;        /* input */
  1619. X
  1620. X    mvaddstr(7, 0, "1:Fight  2:Run Away!  3:Power Blast  ");
  1621. X    if (Luckout)
  1622. X    clrtoeol();
  1623. X    else
  1624. X    addstr("4:Luckout  ");
  1625. X
  1626. X    ch = inputoption();
  1627. X    move(Lines = 8, 0);
  1628. X    clrtobot();
  1629. X
  1630. X    switch (ch)
  1631. X    {
  1632. X    default:    /* fight */
  1633. X        dtemp = ROLL(2.0, Player.p_might);
  1634. XHIT:        
  1635. X        mvprintw(Lines++, 0, "You hit %s %.0f times!", Enemyname, dtemp);
  1636. X        Player.p_sin += 0.5;
  1637. X        Player.p_1scratch += dtemp;
  1638. X        Player.p_istat = I_OFF;
  1639. X        break;
  1640. X
  1641. X    case '2':    /* run away */
  1642. X        Player.p_1scratch -= 1.0;    /* change this to indicate action */
  1643. X        if (random() > 0.25)
  1644. X        {
  1645. X        mvaddstr(Lines++, 0, "You got away!");
  1646. X        Player.p_istat = I_RAN;
  1647. X        }
  1648. X        else
  1649. X        {
  1650. X        mvprintw(Lines++, 0, "%s is still after you!", Enemyname);
  1651. X        Player.p_istat = I_STUCK;
  1652. X        }
  1653. X        break;
  1654. X
  1655. X    case '3':    /* power blast */
  1656. X        dtemp = MIN(Player.p_mana, Player.p_level * 5.0);
  1657. X        Player.p_mana -= dtemp;
  1658. X        dtemp *= (random() + 0.5) * Player.p_magiclvl * 0.2 + 2.0;
  1659. X        mvprintw(Lines++, 0, "You blasted %s !", Enemyname);
  1660. X        goto HIT;
  1661. X
  1662. X    case '4':    /* luckout */
  1663. X        if (Luckout || random() > 0.1)
  1664. X        {
  1665. X        if (Luckout)
  1666. X            mvaddstr(Lines++, 0, "You already tried that!");
  1667. X        else
  1668. X            {
  1669. X            mvaddstr(Lines++, 0, "Not this time . . .");
  1670. X            Luckout = TRUE;
  1671. X            }
  1672. X
  1673. X        Player.p_1scratch -= 1.0;
  1674. X        Player.p_istat = I_BLEWIT;
  1675. X        }
  1676. X        else
  1677. X        {
  1678. X        mvaddstr(Lines++, 0, "You just lucked out!");
  1679. X        Player.p_1scratch = Other.p_energy * 1.1;
  1680. X        }
  1681. X        break;
  1682. X    }
  1683. X
  1684. X    refresh();
  1685. X    Player.p_1scratch = floor(Player.p_1scratch);    /* clean up any mess */
  1686. X
  1687. X    if (Player.p_1scratch > Other.p_energy)
  1688. X    Player.p_istat = I_KILLED;
  1689. X    else if (random() * Player.p_speed < random() * Other.p_speed)
  1690. X    /* relinquish control */
  1691. X    {
  1692. X    ++Player.p_tampered;
  1693. X    Foestrikes = TRUE;
  1694. X    }
  1695. X
  1696. X    writerecord(&Player, Fileloc);            /* let foe know what we did */
  1697. X}
  1698. X/* */
  1699. X/************************************************************************
  1700. X/
  1701. X/ FUNCTION NAME: checktampered()
  1702. X/
  1703. X/ FUNCTION: check if current player has been tampered with
  1704. X/
  1705. X/ AUTHOR: E. A. Estes, 12/4/85
  1706. X/
  1707. X/ ARGUMENTS: none
  1708. X/
  1709. X/ RETURN VALUE: none
  1710. X/
  1711. X/ MODULES CALLED: readrecord(), fread(), fseek(), tampered(), writevoid()
  1712. X/
  1713. X/ GLOBAL INPUTS: *Energyvoidfp, Other, Player, Fileloc, Enrgyvoid
  1714. X/
  1715. X/ GLOBAL OUTPUTS: Enrgyvoid
  1716. X/
  1717. X/ DESCRIPTION:
  1718. X/    Check for energy voids, holy grail, and tampering by other
  1719. X/    players.
  1720. X/
  1721. X/************************************************************************/
  1722. X
  1723. Xchecktampered()
  1724. X{
  1725. Xlong    loc = 0L;        /* location in energy void file */
  1726. X
  1727. X    /* first check for energy voids */
  1728. X    fseek(Energyvoidfp, 0L, 0);
  1729. X    while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
  1730. X    if (Enrgyvoid.ev_active
  1731. X        && Enrgyvoid.ev_x == Player.p_x
  1732. X        && Enrgyvoid.ev_y == Player.p_y)
  1733. X        /* sitting on one */
  1734. X        {
  1735. X        if (loc > 0L)
  1736. X        /* not the holy grail; inactivate energy void */
  1737. X        {
  1738. X        Enrgyvoid.ev_active = FALSE;
  1739. X        writevoid(&Enrgyvoid, loc);
  1740. X        tampered(T_NRGVOID, 0.0, 0.0);
  1741. X        }
  1742. X        else if (Player.p_status != S_CLOAKED)
  1743. X        /* holy grail */
  1744. X        tampered(T_GRAIL, 0.0, 0.0);
  1745. X        break;
  1746. X        }
  1747. X    else
  1748. X        loc += SZ_VOIDSTRUCT;
  1749. X
  1750. X    /* now check for other things */
  1751. X    readrecord(&Other, Fileloc);
  1752. X    if (Other.p_tampered != T_OFF)
  1753. X    tampered(Other.p_tampered, Other.p_1scratch, Other.p_2scratch);
  1754. X}
  1755. X/* */
  1756. X/************************************************************************
  1757. X/
  1758. X/ FUNCTION NAME: tampered()
  1759. X/
  1760. X/ FUNCTION: take care of tampering by other players
  1761. X/
  1762. X/ AUTHOR: E. A. Estes, 12/4/85
  1763. X/
  1764. X/ ARGUMENTS:
  1765. X/    int what - what type of tampering
  1766. X/    double arg1, arg2 - rest of tampering info
  1767. X/
  1768. X/ RETURN VALUE: none
  1769. X/
  1770. X/ MODULES CALLED: writerecord(), more(), fread(), death(), fseek(), sleep(), 
  1771. X/    floor(), wmove(), waddch(), random(), printw(), altercoordinates(), 
  1772. X/    waddstr(), wrefresh(), encounter(), writevoid()
  1773. X/
  1774. X/ GLOBAL INPUTS: Other, Player, *stdscr, Enrgyvoid, *Playersfp
  1775. X/
  1776. X/ GLOBAL OUTPUTS: Other, Player, Changed, Enrgyvoid
  1777. X/
  1778. X/ DESCRIPTION:
  1779. X/    Take care of energy voids, holy grail, decree and intervention
  1780. X/    action on current player.
  1781. X/
  1782. X/************************************************************************/
  1783. X
  1784. Xtampered(what, arg1, arg2)
  1785. Xint    what;
  1786. Xdouble    arg1;
  1787. Xdouble    arg2;
  1788. X{
  1789. Xlong    loc;            /* location in file of other players */
  1790. X
  1791. X    Changed = TRUE;
  1792. X    move(4,0);
  1793. X
  1794. X    Player.p_tampered = T_OFF;    /* no longer tampered with */
  1795. X
  1796. X    switch (what)
  1797. X    {
  1798. X    case T_NRGVOID:
  1799. X        addstr("You've hit an energy void !\n");
  1800. X        Player.p_mana /= 3.0;
  1801. X        Player.p_energy /= 2.0;
  1802. X        Player.p_gold = floor(Player.p_gold/1.25) + 0.1;
  1803. X        altercoordinates(0.0, 0.0, A_NEAR);
  1804. X        break;
  1805. X
  1806. X    case T_TRANSPORT:
  1807. X        addstr("The king transported you !  ");
  1808. X        if (Player.p_charms > 0)
  1809. X        {
  1810. X        addstr("But your charm save you. . .\n");
  1811. X        --Player.p_charms;
  1812. X        }
  1813. X        else
  1814. X        {
  1815. X        altercoordinates(0.0, 0.0, A_FAR);
  1816. X        addch('\n');
  1817. X        }
  1818. X        break;
  1819. X
  1820. X    case T_BESTOW:
  1821. X        printw("The king has bestowed %.0f gold pieces on you !\n", arg1);
  1822. X        Player.p_gold += arg1;
  1823. X        break;
  1824. X
  1825. X    case T_CURSED:
  1826. X        addstr("You've been cursed !  ");
  1827. X        if (Player.p_blessing)
  1828. X        {
  1829. X        addstr("But your blessing saved you. . .\n");
  1830. X        Player.p_blessing = FALSE;
  1831. X        }
  1832. X        else
  1833. X        {
  1834. X        addch('\n');
  1835. X        Player.p_poison += 2.0;
  1836. X        Player.p_energy = 10.0;
  1837. X        Player.p_maxenergy  *= 0.95;
  1838. X        Player.p_status = S_PLAYING;    /* no longer cloaked */
  1839. X        }
  1840. X        break;
  1841. X
  1842. X    case T_VAPORIZED:
  1843. X        addstr("You have been vaporized!\n");
  1844. X        more(7);
  1845. X        death("Vaporization");
  1846. X        break;
  1847. X
  1848. X    case T_MONSTER:
  1849. X        addstr("The Valar zapped you with a monster!\n");
  1850. X        more(7);
  1851. X        encounter((int) arg1);
  1852. X        return;
  1853. X
  1854. X    case T_BLESSED:
  1855. X        addstr("The Valar has blessed you!\n");
  1856. X        Player.p_energy = (Player.p_maxenergy *= 1.05) + Player.p_shield;
  1857. X        Player.p_mana += 500.0;
  1858. X        Player.p_strength += 0.5;
  1859. X        Player.p_brains += 0.5;
  1860. X        Player.p_magiclvl += 0.5;
  1861. X        Player.p_poison = MIN(0.5, Player.p_poison);
  1862. X        break;
  1863. X
  1864. X    case T_RELOCATE:
  1865. X        addstr("You've been relocated. . .\n");
  1866. X        altercoordinates(arg1, arg2, A_FORCED);
  1867. X        break;
  1868. X
  1869. X    case T_HEAL:
  1870. X        addstr("You've been healed!\n");
  1871. X        Player.p_poison -=  0.25;
  1872. X        Player.p_energy = Player.p_maxenergy + Player.p_shield;
  1873. X        break;
  1874. X
  1875. X    case T_EXVALAR:
  1876. X        addstr("You are no longer Valar!\n");
  1877. X        Player.p_specialtype = SC_COUNCIL;
  1878. X        break;
  1879. X
  1880. X    case T_GRAIL:
  1881. X        addstr("You have found The Holy Grail!!\n");
  1882. X        if (Player.p_specialtype < SC_COUNCIL)
  1883. X        /* must be council of wise to behold grail */
  1884. X        {
  1885. X        addstr("However, you are not experienced enough to behold it.\n");
  1886. X        Player.p_sin *= Player.p_sin;
  1887. X        Player.p_mana +=  1000;
  1888. X        }
  1889. X        else if (Player.p_specialtype == SC_VALAR
  1890. X        || Player.p_specialtype == SC_EXVALAR)
  1891. X        {
  1892. X        addstr("You have made it to the position of Valar once already.\n");
  1893. X        addstr("The Grail is of no more use to you now.\n");
  1894. X        }
  1895. X        else
  1896. X        {
  1897. X        addstr("It is now time to see if you are worthy to behold it. . .\n");
  1898. X        refresh();
  1899. X        sleep(4);
  1900. X
  1901. X        if (random() / 2.0 < Player.p_sin)
  1902. X            {
  1903. X            addstr("You have failed!\n");
  1904. X            Player.p_strength =
  1905. X            Player.p_mana =
  1906. X            Player.p_energy =
  1907. X            Player.p_maxenergy =
  1908. X            Player.p_magiclvl = 
  1909. X            Player.p_brains =
  1910. X            Player.p_experience =
  1911. X            Player.p_quickness = 1.0;
  1912. X
  1913. X            altercoordinates(1.0, 1.0, A_FORCED);
  1914. X            Player.p_level = 0.0;
  1915. X            }
  1916. X        else
  1917. X            {
  1918. X            addstr("You made to position of Valar!\n");
  1919. X            Player.p_specialtype = SC_VALAR;
  1920. X            Player.p_lives = 5;
  1921. X            fseek(Playersfp, 0L, 0);
  1922. X            loc = 0L;
  1923. X            while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
  1924. X            /* search for existing valar */
  1925. X            if (Other.p_specialtype == SC_VALAR
  1926. X                && Other.p_status != S_NOTUSED)
  1927. X                /* found old valar */
  1928. X                {
  1929. X                Other.p_tampered = T_EXVALAR;
  1930. X                writerecord(&Other, loc);
  1931. X                break;
  1932. X                }
  1933. X            else
  1934. X                loc += SZ_PLAYERSTRUCT;
  1935. X            }
  1936. X        }
  1937. X
  1938. X        /* move grail to new location */
  1939. X        Enrgyvoid.ev_active = TRUE;
  1940. X        Enrgyvoid.ev_x = ROLL(-1e6, 2e6);
  1941. X        Enrgyvoid.ev_y = ROLL(-1e6, 2e6);
  1942. X        writevoid(&Enrgyvoid, 0L);
  1943. X        break;
  1944. X    }
  1945. X    refresh();
  1946. X    sleep(2);
  1947. X}
  1948. X/* */
  1949. X/************************************************************************
  1950. X/
  1951. X/ FUNCTION NAME: userlist()
  1952. X/
  1953. X/ FUNCTION: print list of players and locations
  1954. X/
  1955. X/ AUTHOR: E. A. Estes, 2/28/86
  1956. X/
  1957. X/ ARGUMENTS:
  1958. X/    bool ingameflag - set if called while playing
  1959. X/
  1960. X/ RETURN VALUE: none
  1961. X/
  1962. X/ MODULES CALLED: descrstatus(), descrlocation(), more(), fread(), fseek(), 
  1963. X/    floor(), wmove(), printw(), waddstr(), distance(), wrefresh(), 
  1964. X/    descrtype(), wclrtobot()
  1965. X/
  1966. X/ GLOBAL INPUTS: LINES, Other, Circle, Wizard, Player, *stdscr, *Playersfp
  1967. X/
  1968. X/ GLOBAL OUTPUTS: none
  1969. X/
  1970. X/ DESCRIPTION:
  1971. X/    We can only see the coordinate of those closer to the origin
  1972. X/    from us.
  1973. X/    Kings and council of the wise can see and can be seen by everyone.
  1974. X/    Palantirs are good for seeing everyone; and the valar can use
  1975. X/    one to see through a 'cloak' spell.
  1976. X/    The valar has no coordinates, and is completely invisible if
  1977. X/    cloaked.
  1978. X/
  1979. X/************************************************************************/
  1980. X
  1981. Xuserlist(ingameflag)
  1982. Xbool    ingameflag;
  1983. X{
  1984. Xregister int    numusers = 0;    /* number of users on file */
  1985. X
  1986. X    if (ingameflag && Player.p_blindness)
  1987. X    {
  1988. X    mvaddstr(8, 0, "You cannot see anyone.\n");
  1989. X    return;
  1990. X    }
  1991. X
  1992. X    fseek(Playersfp, 0L, 0);
  1993. X    mvaddstr(8, 0,
  1994. X    "Name                         X         Y    Lvl Type Login    Status\n");
  1995. X
  1996. X    while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
  1997. X    {
  1998. X    if (Other.p_status == S_NOTUSED
  1999. X        /* record is unused */
  2000. X        || (Other.p_specialtype == SC_VALAR && Other.p_status == S_CLOAKED))
  2001. X        /* cloaked valar */
  2002. X        {
  2003. X        if (!Wizard)
  2004. X        /* wizard can see everything on file */
  2005. X        continue;
  2006. X        }
  2007. X
  2008. X        ++numusers;
  2009. X
  2010. X        if (ingameflag &&
  2011. X        /* must be playing for the rest of these conditions */
  2012. X        (Player.p_specialtype >= SC_KING
  2013. X        /* kings and higher can see others */
  2014. X        || Other.p_specialtype >= SC_KING
  2015. X        /* kings and higher can be seen by others */
  2016. X        || Circle >= CIRCLE(Other.p_x, Other.p_y)
  2017. X        /* those nearer the origin can be seen */
  2018. X        || Player.p_palantir)
  2019. X        /* palantir enables one to see others */
  2020. X        && (Other.p_status != S_CLOAKED 
  2021. X            || (Player.p_specialtype == SC_VALAR && Player.p_palantir))
  2022. X        /* not cloaked; valar can see through cloak with a palantir */
  2023. X        && Other.p_specialtype != SC_VALAR)
  2024. X        /* not a valar */
  2025. X        /* coordinates should be printed */
  2026. X        printw("%-20s  %8.0f  %8.0f ",
  2027. X            Other.p_name, Other.p_x, Other.p_y);
  2028. X        else
  2029. X        /* cannot see player's coordinates */
  2030. X        printw("%-20s %19.19s ",
  2031. X            Other.p_name, descrlocation(&Other, TRUE));
  2032. X    
  2033. X    printw("%6.0f %s  %-9.9s%s\n", Other.p_level, descrtype(&Other, TRUE),
  2034. X        Other.p_login, descrstatus(&Other));
  2035. X
  2036. X    if ((numusers % (LINES - 10)) == 0)
  2037. X        {
  2038. X        more(LINES - 1);
  2039. X        move(9, 0);
  2040. X        clrtobot();
  2041. X        }
  2042. X    }
  2043. X
  2044. X    printw("Total players on file = %d\n", numusers);
  2045. X    refresh();
  2046. X}
  2047. X/* */
  2048. X/************************************************************************
  2049. X/
  2050. X/ FUNCTION NAME: throneroom()
  2051. X/
  2052. X/ FUNCTION: king stuff upon entering throne
  2053. X/
  2054. X/ AUTHOR: E. A. Estes, 12/16/85
  2055. X/
  2056. X/ ARGUMENTS: none
  2057. X/
  2058. X/ RETURN VALUE: none
  2059. X/
  2060. X/ MODULES CALLED: writerecord(), fread(), fseek(), fopen(), wmove(), fclose(), 
  2061. X/    fwrite(), altercoordinates(), waddstr(), fprintf()
  2062. X/
  2063. X/ GLOBAL INPUTS: *Energyvoidfp, Other, Player, *stdscr, Voidfile[], 
  2064. X/    Messfile[], Enrgyvoid, *Playersfp
  2065. X/
  2066. X/ GLOBAL OUTPUTS: Other, Player, Changed
  2067. X/
  2068. X/ DESCRIPTION:
  2069. X/    If player is not already king, make him/her so if the old king
  2070. X/    is not playing.
  2071. X/    Clear energy voids with new king.
  2072. X/    Print 'decree' prompt.
  2073. X/
  2074. X/************************************************************************/
  2075. X
  2076. Xthroneroom()
  2077. X{
  2078. XFILE    *fp;            /* to clear energy voids */
  2079. Xlong    loc = 0L;        /* location of old king in player file */
  2080. X
  2081. X    if (Player.p_specialtype < SC_KING)
  2082. X    /* not already king -- assumes crown */
  2083. X    {
  2084. X    fseek(Playersfp, 0L, 0);
  2085. X    while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
  2086. X        if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED)
  2087. X        /* found old king */
  2088. X        {
  2089. X        if (Other.p_status != S_OFF)
  2090. X            /* old king is playing */
  2091. X            {
  2092. X            mvaddstr( 4, 0, "The king is playing, so you cannot steal his throne\n");
  2093. X            altercoordinates(0.0, 0.0, A_NEAR);
  2094. X            move(6, 0);
  2095. X            return;
  2096. X            }
  2097. X        else
  2098. X            /* old king is not playing - remove him/her */
  2099. X            {
  2100. X            Other.p_specialtype = SC_NONE;
  2101. X            if (Other.p_crowns)
  2102. X            --Other.p_crowns;
  2103. X            writerecord(&Other, loc);
  2104. X            break;
  2105. X            }
  2106. X        }
  2107. X        else
  2108. X        loc += SZ_PLAYERSTRUCT;
  2109. X
  2110. X    /* make player new king */
  2111. X    Changed = TRUE;
  2112. X    Player.p_specialtype = SC_KING;
  2113. X    mvaddstr(4, 0, "You have become king!\n");
  2114. X
  2115. X    /* let everyone else know */
  2116. X    fp = fopen(Messfile, "w");
  2117. X    fprintf(fp, "All hail the new king!");
  2118. X    fclose(fp);
  2119. X
  2120. X    /* clear all energy voids; retain location of holy grail */
  2121. X    fseek(Energyvoidfp, 0L, 0);
  2122. X    fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
  2123. X    fp = fopen(Voidfile, "w");
  2124. X    fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
  2125. X    fclose(fp);
  2126. X    }
  2127. X
  2128. X    mvaddstr(6, 0, "0:Decree  ");
  2129. X}
  2130. X/* */
  2131. X/************************************************************************
  2132. X/
  2133. X/ FUNCTION NAME: dotampered()
  2134. X/
  2135. X/ FUNCTION: king and valar special options
  2136. X/
  2137. X/ AUTHOR: E. A. Estes, 2/28/86
  2138. X/
  2139. X/ ARGUMENTS: none
  2140. X/
  2141. X/ RETURN VALUE: none
  2142. X/
  2143. X/ MODULES CALLED: writerecord(), truncstring(), fread(), fseek(), fopen(), 
  2144. X/    floor(), wmove(), random(), fclose(), fwrite(), sscanf(), strcmp(), 
  2145. X/    infloat(), waddstr(), findname(), distance(), userlist(), mvprintw(), 
  2146. X/    allocvoid(), getanswer(), getstring(), wclrtoeol(), writevoid()
  2147. X/
  2148. X/ GLOBAL INPUTS: *Energyvoidfp, Other, Illcmd[], Wizard, Player, *stdscr, 
  2149. X/    Databuf[], Goldfile[], Enrgyvoid
  2150. X/
  2151. X/ GLOBAL OUTPUTS: Other, Player, Enrgyvoid
  2152. X/
  2153. X/ DESCRIPTION:
  2154. X/    Tamper with other players.  Handle king/valar specific options.
  2155. X/
  2156. X/************************************************************************/
  2157. X
  2158. Xdotampered()
  2159. X{
  2160. Xshort    tamper;            /* value for tampering with other players */
  2161. Xchar    *option;            /* pointer to option description */
  2162. Xdouble    temp1 = 0.0, temp2 = 0.0;    /* other tampering values */
  2163. Xint    ch;                /* input */
  2164. Xlong    loc;                /* location in energy void file */
  2165. XFILE    *fp;                /* for opening gold file */
  2166. X
  2167. X    move(6, 0);
  2168. X    clrtoeol();
  2169. X    if (Player.p_specialtype < SC_COUNCIL && !Wizard)
  2170. X    /* king options */
  2171. X    {
  2172. X    addstr("1:Transport  2:Curse  3:Energy Void  4:Bestow  5:Collect Taxes  ");
  2173. X
  2174. X    ch = getanswer(" ", TRUE);
  2175. X    move(6, 0);
  2176. X    clrtoeol();
  2177. X    move(4, 0);
  2178. X    switch (ch)
  2179. X        {
  2180. X        case '1':    /* transport someone */
  2181. X        tamper = T_TRANSPORT;
  2182. X        option = "transport";
  2183. X        break;
  2184. X
  2185. X        case '2':    /* curse another */
  2186. X        tamper = T_CURSED;
  2187. X        option = "curse";
  2188. X        break;
  2189. X
  2190. X        case '3':    /* create energy void */
  2191. X        if ((loc = allocvoid()) > 20L * SZ_VOIDSTRUCT)
  2192. X            /* can only have 20 void active at once */
  2193. X            mvaddstr(5, 0, "Sorry, void creation limit reached.\n");
  2194. X        else
  2195. X            {
  2196. X            addstr("Enter the X Y coordinates of void ? ");
  2197. X            getstring(Databuf, SZ_DATABUF);
  2198. X            sscanf(Databuf, "%F %F", &temp1, &temp2);
  2199. X            Enrgyvoid.ev_x = floor(temp1);
  2200. X            Enrgyvoid.ev_y = floor(temp2);
  2201. X            Enrgyvoid.ev_active = TRUE;
  2202. X            writevoid(&Enrgyvoid, loc);
  2203. X            mvaddstr(5, 0, "It is done.\n");
  2204. X            }
  2205. X        return;
  2206. X
  2207. X        case '4':    /* bestow gold to subject */
  2208. X        tamper = T_BESTOW;
  2209. X        addstr("How much gold to bestow ? ");
  2210. X        temp1 = infloat();
  2211. X        if (temp1 > Player.p_gold || temp1 < 0)
  2212. X            {
  2213. X            mvaddstr(5, 0, "You don't have that !\n");
  2214. X            return;
  2215. X            }
  2216. X
  2217. X        Player.p_gold -= floor(temp1);
  2218. X        option = "give gold to";
  2219. X        break;
  2220. X
  2221. X        case '5':    /* collect accumulated taxes */
  2222. X        if ((fp = fopen(Goldfile, "r+")) != NULL)
  2223. X            /* collect taxes */
  2224. X            {
  2225. X            fread((char *) &temp1, sizeof(double), 1, fp);
  2226. X            fseek(fp, 0L, 0);
  2227. X            /* clear out value */
  2228. X            temp2 = 0.0;
  2229. X            fwrite((char *) &temp2, sizeof(double), 1, fp);
  2230. X            fclose(fp);
  2231. X            }
  2232. X
  2233. X        mvprintw(4, 0, "You have collected %.0f in gold.\n", temp1);
  2234. X        Player.p_gold += floor(temp1);
  2235. X        return;
  2236. X
  2237. X        default:
  2238. X        return;
  2239. X        }
  2240. X    /* end of king options */
  2241. X    }
  2242. X    else
  2243. X    /* council of wise, valar, wizard options */
  2244. X    {
  2245. X    addstr("1:Heal  ");
  2246. X    if (Player.p_palantir || Wizard)
  2247. X        addstr("2:Seek Grail  ");
  2248. X    if (Player.p_specialtype == SC_VALAR || Wizard)
  2249. X        addstr("3:Throw Monster  4:Relocate  5:Bless  ");
  2250. X    if (Wizard)
  2251. X        addstr("6:Vaporize  ");
  2252. X
  2253. X    ch = getanswer(" ", TRUE);
  2254. X    if (!Wizard)
  2255. X        {
  2256. X        if (ch > '2' && Player.p_specialtype != SC_VALAR)
  2257. X        {
  2258. X        ILLCMD();
  2259. X        return;
  2260. X        }
  2261. X
  2262. X        if (Player.p_mana < MM_INTERVENE)
  2263. X        {
  2264. X        mvaddstr(5, 0, "No mana left.\n");
  2265. X        return;
  2266. X        }
  2267. X        else
  2268. X        Player.p_mana -= MM_INTERVENE;
  2269. X        }
  2270. X
  2271. X    switch (ch)
  2272. X        {
  2273. X        case '1':    /* heal another */
  2274. X        tamper = T_HEAL;
  2275. X        option = "heal";
  2276. X        break;
  2277. X
  2278. X        case '2':    /* seek grail */
  2279. X        if (Player.p_palantir)
  2280. X            /* need a palantir to seek */
  2281. X            {
  2282. X            fseek(Energyvoidfp, 0L, 0);
  2283. X            fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
  2284. X            temp1 = distance(Player.p_x, Enrgyvoid.ev_x, Player.p_y, Enrgyvoid.ev_y);
  2285. X            temp1 += ROLL(-temp1 / 10.0, temp1 / 5.0);    /* add some error */
  2286. X            mvprintw(5, 0, "The palantir says the Grail is about %.0f away.\n", temp1);
  2287. X            }
  2288. X        else
  2289. X            /* no palantir */
  2290. X            mvaddstr(5, 0, "You need a palantir to seek the Grail.\n");
  2291. X        return;
  2292. X
  2293. X        case '3':    /* lob monster at someone */
  2294. X        mvaddstr(4, 0, "Which monster [0-99] ? ");
  2295. X        temp1 = infloat();
  2296. X        temp1 = MAX(0.0, MIN(99.0, temp1));
  2297. X        tamper = T_MONSTER;
  2298. X        option = "throw a monster at";
  2299. X        break;
  2300. X
  2301. X        case '4':    /* move another player */
  2302. X        mvaddstr(4, 0, "New X Y coordinates ? ");
  2303. X        getstring(Databuf, SZ_DATABUF);
  2304. X        sscanf(Databuf, "%F %F", &temp1, &temp2);
  2305. X        tamper = T_RELOCATE;
  2306. X        option = "relocate";
  2307. X        break;
  2308. X
  2309. X        case '5':    /* bless a player */
  2310. X        tamper = T_BLESSED;
  2311. X        option = "bless";
  2312. X        break;
  2313. X
  2314. X        case '6':    /* kill off a player */
  2315. X        if (Wizard)
  2316. X            {
  2317. X            tamper = T_VAPORIZED;
  2318. X            option = "vaporize";
  2319. X            break;
  2320. X            }
  2321. X        else
  2322. X            return;
  2323. X
  2324. X        default:
  2325. X        return;
  2326. X        }
  2327. X
  2328. X    if (!Wizard)
  2329. X        Player.p_age += N_AGE;        /* penalty for using this stuff */
  2330. X    /* end of valar, etc. options */
  2331. X    }
  2332. X
  2333. X    for (;;)
  2334. X    /* prompt for player to affect */
  2335. X    {
  2336. X    mvprintw(4, 0, "Who do you want to %s ? ", option);
  2337. X    getstring(Databuf, SZ_DATABUF);
  2338. X    truncstring(Databuf);
  2339. X
  2340. X    if (Databuf[0] == '\0')
  2341. X        userlist(TRUE);
  2342. X    else
  2343. X        break;
  2344. X    }
  2345. X
  2346. X    if (strcmp(Player.p_name, Databuf) != 0)
  2347. X    /* name other than self */
  2348. X    {
  2349. X    if ((loc = findname(Databuf, &Other)) >= 0L)
  2350. X        {
  2351. X        if (Other.p_tampered != T_OFF)
  2352. X        {
  2353. X        mvaddstr(5, 0, "That person has something pending already.\n");
  2354. X        return;
  2355. X        }
  2356. X        else
  2357. X        {
  2358. X        if (tamper == T_RELOCATE
  2359. X            && CIRCLE(temp1, temp2) < CIRCLE(Other.p_x, Other.p_y)
  2360. X            && !Wizard)
  2361. X            mvaddstr(5, 0, "Cannot move someone closer to the Lord's Chamber.\n");
  2362. X        else
  2363. X            {
  2364. X            Other.p_tampered = tamper;
  2365. X            Other.p_1scratch = floor(temp1);
  2366. X            Other.p_2scratch = floor(temp2);
  2367. X            writerecord(&Other, loc);
  2368. X            mvaddstr(5, 0, "It is done.\n");
  2369. X            }
  2370. X        return;
  2371. X        }
  2372. X        }
  2373. X    else
  2374. X        /* player not found */
  2375. X        mvaddstr(5, 0, "There is no one by that name.\n");
  2376. X    }
  2377. X    else
  2378. X    /* self */
  2379. X    mvaddstr(5, 0, "You may not do it to yourself!\n");
  2380. X}
  2381. X/* */
  2382. X/************************************************************************
  2383. X/
  2384. X/ FUNCTION NAME: writevoid()
  2385. X/
  2386. X/ FUNCTION: update energy void entry in energy void file
  2387. X/
  2388. X/ AUTHOR: E. A. Estes, 12/4/85
  2389. X/
  2390. X/ ARGUMENTS:
  2391. X/    struct energyvoid *vp - pointer to structure to write to file
  2392. X/    long loc - location in file to update
  2393. X/
  2394. X/ RETURN VALUE: none
  2395. X/
  2396. X/ MODULES CALLED: fseek(), fwrite(), fflush()
  2397. X/
  2398. X/ GLOBAL INPUTS: *Energyvoidfp
  2399. X/
  2400. X/ GLOBAL OUTPUTS: none
  2401. X/
  2402. X/ DESCRIPTION:
  2403. X/    Write out energy void structure at specified location.
  2404. X/
  2405. X/************************************************************************/
  2406. X
  2407. Xwritevoid(vp, loc)
  2408. Xregister struct energyvoid    *vp;
  2409. Xlong    loc;
  2410. X{
  2411. X
  2412. X    fseek(Energyvoidfp, loc, 0);
  2413. X    fwrite((char *) vp, SZ_VOIDSTRUCT, 1, Energyvoidfp);
  2414. X    fflush(Energyvoidfp);
  2415. X}
  2416. X/* */
  2417. X/************************************************************************
  2418. X/
  2419. X/ FUNCTION NAME: allocvoid()
  2420. X/
  2421. X/ FUNCTION: allocate space for a new energy void
  2422. X/
  2423. X/ AUTHOR: E. A. Estes, 12/4/85
  2424. X/
  2425. X/ ARGUMENTS: none
  2426. X/
  2427. X/ RETURN VALUE: location of new energy void space
  2428. X/
  2429. X/ MODULES CALLED: fread(), fseek()
  2430. X/
  2431. X/ GLOBAL INPUTS: *Energyvoidfp, Enrgyvoid
  2432. X/
  2433. X/ GLOBAL OUTPUTS: none
  2434. X/
  2435. X/ DESCRIPTION:
  2436. X/    Search energy void file for an inactive entry and return its
  2437. X/    location.
  2438. X/    If no inactive ones are found, return one more than last location.
  2439. X/
  2440. X/************************************************************************/
  2441. X
  2442. Xlong
  2443. Xallocvoid()
  2444. X{
  2445. Xlong    loc = 0L;        /* location of new energy void */
  2446. X
  2447. X    fseek(Energyvoidfp, 0L, 0);
  2448. X    while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
  2449. X    if (Enrgyvoid.ev_active)
  2450. X        loc += SZ_VOIDSTRUCT;
  2451. X    else
  2452. X        break;
  2453. X
  2454. X    return(loc);
  2455. X}
  2456. !EOR!
  2457.  
  2458.  
  2459.